package basic.com.liz.mongo.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;

import basic.com.liz.mongo.domain.LizUser;
import basic.com.liz.mongo.service.UserService;

@Service
public class UserServiceImpl extends AbastracSyncMongo implements UserService
{
    
    @Override
    public void save(LizUser user)
    {
        System.out.println("开始" + new Date());
        List<LizUser> userList = new ArrayList<LizUser>();
        for (int i = 0; i < 1100; i++)
        {
            user = new LizUser();
            user.setId(Long.valueOf(String(i)));
            user.setAge(12);
            user.setName("百度");
            userList.add(user);
            System.out.println(user.getId());
        }
        super.saveBatchMongoEntity(userList, "user");
        System.out.println("成功" + new Date());
    }
    
    private String String(int i)
    {
        Integer va = i + 1;
        
        return va.toString();
    }
    
}
